package unrepeatablereads;
import java.sql.*;

public class T2 {
	public static void main(String[] args) throws Exception {
		Connection connection = DriverManager.getConnection("jdbc:pointbase:server://127.0.0.1/StaplerzDB", "PBPUBLIC", "PBPUBLIC");
		connection.setAutoCommit(false);		
		Statement query = connection.createStatement();
		
		query.execute("UPDATE order_items SET quantity=1 WHERE sku='0001' AND orderid=1");
		Thread.sleep(4000);
		query.execute("UPDATE order_items SET quantity=2 WHERE sku='0001' AND orderid=1");
		Thread.sleep(4000);
		query.execute("UPDATE order_items SET quantity=3 WHERE sku='0001' AND orderid=1");
		Thread.sleep(4000);
		
		connection.commit();
		connection.close();
		
		System.out.println("done.");
	}
}